<ion-header>
    <ion-navbar core-back-button>
        <ion-title>{{ 'addon.competency.userplans' | translate }}</ion-title>
    </ion-navbar>
</ion-header>
<core-split-view>
    <ion-content>
        <ion-refresher [enabled]="plansLoaded" (ionRefresh)="refreshLearningPlans($event)">
            <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
        </ion-refresher>
        <core-loading [hideUntil]="plansLoaded">
            <core-empty-box *ngIf="plans.length == 0" icon="map" [message]="'addon.competency.noplanswerecreated' | translate">
            </core-empty-box>
            <ion-list *ngIf="plans.length > 0" no-margin>
                <a ion-item text-wrap *ngFor="let plan of plans" [title]="plan.name" (click)="openPlan(plan.id)" [class.core-split-item-selected]="plan.id == planId">
                    <h2>{{ plan.name }}</h2>
                    <p *ngIf="plan.duedate > 0">{{ 'addon.competency.duedate' | translate }}: {{ plan.duedate * 1000 | coreFormatDate :'strftimedatetimeshort' }}</p>
                    <ion-badge item-end text-wrap [color]="plan.statuscolor">{{ plan.statusname }}</ion-badge>
                </a>
            </ion-list>
        </core-loading>
    </ion-content>
</core-split-view>
